:: =====================================================================================
:: SOURCE FILE NAME = flash.bat
::
:: DESCRIPTION = sample of batch file to run test off network
:: Copyright 1999 Dell Computer Corporation
:: All rights reserved
::
:: CHANGES MADE
:: DATE          PROGRAMMER     VSV     DESCRIPTION
:: ----------	--------------	------	---------------------------------------------
:: 03/15/2000	    CMN         000	Initial creation
:: 11.17.2000	Isaac Le Grand	001	A01
:: 12.01.2000   Chip Ueltschey  002     Implimented standard naming convention
::					add deployed A02
::
:: =====================================================================================
errlvl 255
if not "%1"=="" goto %1

set flash_path=%diag_path%\%diagver%

:: Force flash if %P_BIOS% or INFO 11665 exist
if "%P_BIOS%"=="YES" goto flashit
search %localdrive%\sdr "11665 INFO, BIOS PILOT"
if errorlevel 1 goto flashit

:: check if flash is needed
%net_drive%\_prctool\biosver\000\biosver flash
if errorlevel 255 goto end
if not errorlevel 1 goto end

:flashit
:: Use ramdisk for Dell+ preloaded image 
if "%SI%"=="NO" goto :chk4hdd
search %localdrive%\barfile "C01351"
if errorlevel 1 goto setup_ramdsk

:chk4hdd
:: Use ramdisk if HDD is not available
if not exist c:\nul goto :setup_ramdsk
set tmpdisk=c:\
goto :setup_test

:setup_ramdsk
%net_drive%\_prctool\xgrep -y "ramdrive" %localdrive%\config.sys
if not errorlevel 1 goto :chk4ramdisk
if exist a:\config.sys if exist a:\dos6dnl.sys copy a:\dos6dnl.sys a:\config.sys
if exist c:\config.sys if exist c:\dos6dnl.sys copy a:\config.sys  c:\config.sys
echo d>%localdrive%\swap.sys
boot

:chk4ramdisk
kolache tmpdisk
if errorlevel 1 goto ramdrv_fail
if "%tmpdisk%"=="" goto ramdrv_fail

:setup_test
:: This block to support a specific test :::::::::::::::::::::::::::::::::::::

:: copy test to %tmpdisk%
copy %flash_path%\*.* %tmpdisk%

:: call test
%tmpdisk%flash starttest

:starttest
call dd_login unload
:: functional test goes here
errlvl 255
if not exist %localdrive%\swap.sys goto noswap
if exist a:\config.sys if exist a:\dos6diag.sys copy a:\dos6diag.sys a:\config.sys
if exist c:\config.sys if exist c:\dos6diag.sys copy a:\config.sys   c:\config.sys
del %localdrive%\swap.sys

:noswap
if exist %localdrive%\re_run.bat del %localdrive%\re_run.bat
%tmpdisk%8100_%DIAGVER% -nopause -prgboot -wipeclean -forceit
goto failtest

:: End this block to support a specific test :::::::::::::::::::::::::::::::::::::

:ramdisk_fail
errlvl 1
echo RAM Drive not loaded.>>%localdrive%\test.err

:failtest
echo test failed...															
echo test failed>%LOCALDRIVE%\test.err

:end
set diagver=
set diagver1=
set flash_path
set diag_path=
cd %net_drive%\
%localdrive%
